package com.example.java2mysql2.instrastructure;

import com.example.java2mysql2.domain.Team;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import javax.persistence.criteria.CriteriaBuilder;
import javax.transaction.Transactional;
import java.util.List;

@Repository
public interface JpaTeam extends JpaRepository<Team,Long> {
    Team findByTeamCode(String code);
    @Transactional
    void deleteByTeamCode(String code);
    @Query("select distinct t from Team t left join t.students s where s.id > ?1")
    List<Team> findTeamInfo(Long i);
}
